package ua.soso.ui.dwr;

import org.directwebremoting.annotations.RemoteMethod;
import org.directwebremoting.annotations.RemoteProxy;
import org.springframework.beans.factory.annotation.Required;
import ua.soso.dao.model.User;
import ua.soso.service.UserService;

/**
 * Java Doc here
 *
 * @author Babka Aleksey
 * @since 2012-05-08 18:44
 */
@RemoteProxy(name = "UserServiceRemote")
public class UserServiceRemote {
    private UserService userService;

    @Required
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    @RemoteMethod
    public boolean register(String login, String password, String name, String email) {
        User user = new User();

        user.setLogin(login);
        user.setPassword(password);
        user.setName(name);
        user.setEmail(email);

        return userService.saveUser(user);
    }
}
